
**** 
clear
set more off

* open data
use "0_data_for_analyses_.dta"


gen treat_ment=.
replace treat_ment=1 if tratamiento==3 //control condition
replace treat_ment=2 if tratamiento==1 //disagreement
replace treat_ment=3 if tratamiento==2 //perspective taking
drop tratamiento



**

tab gender
encode gender, gen(gen)
tab gen
drop gender

tab age
destring age,replace
tab age
replace age=(2019-age)
mean age if age<70
sum age if age<70
replace age=45 if age>70 //replacing the ages which do not seem to be true with the median age
tab age
mean age
destring education,replace
destring region,replace

by treat_ment, sort : summarize cc_score

gen stand_score=(cc_score-24.9034)/23.70348  // consistent with Simonovits et al 2019, I standarize the DV by the mean and variance in the congrol group

by treat_ment,sort: summarize cc_spillover

gen stand_spillover=(cc_spillover-28.98629)/26.82443 


// in the party_other variable, I have manually introduced those responses that were Green, so a separate value for the variable "party" [because of typo and differently written words, it was difficult to merge them into one category]
replace party_other = "Green" in 250
replace party_other = "Green" in 379
replace party_other = "Green" in 409
replace party_other = "Green" in 434
replace party_other = "Green" in 519
replace party_other = "Green" in 592
replace party_other = "Green" in 625
replace party_other = "Green" in 969
replace party_other = "Green" in 1094
replace party_other = "Green" in 1213
replace party_other = "Green" in 1466
replace party_other = "Green" in 1471
replace party_other = "Green" in 1495
replace party_other = "Green" in 1404
replace party_other = "Green" in 781
replace party=8 if party_other=="Green"
replace party=8 if party_other=="Green"
***

replace party_other = "SNP" in 205
replace party_other = "SNP" in 477
replace party_other = "SNP" in 1047
replace party_other = "SNP" in 1184
replace party_other = "SNO" in 1294
replace party_other = "SNP" in 1294
replace party_other = "SNP" in 1389
replace party_other = "SNP" in 1482
replace party_other = "SNP" in 1701
replace party_other = "SNP" in 716
replace party_other = "SNP" in 696
replace party=9 if party_other=="SNP"
replace party=9 if party_other=="SNP"
tab party // labour, conservative, liberal democrat, ukip, other, none, dont know, green, snp

recode party (5 6 7=7 "none/don'tknow/other")(1=1 "labour")(2=2 "conservative")(3=3 "liberal democrat")(4=4 "UKIP")(8=5 "green") (9=6 "SNP"),gen(partisanship)
tab partisanship
tab party
drop party party_other
**
***

destring pre_bi_at,replace
destring policy_at_bi,replace

gen transformation=(pre_bi_at-policy_at_bi)
tab transformation

recode ideology (0 1 2 3 4=1 left)(5=2 centre)(6 7 8 9 10=3 right),gen(cat_ideol)
tab cat_ideol
recode education (6=.)   /// other category, small n


******FIGURE 2. Empathic Concern Induced by Writing Exercise*****

gen c_index=(c1+c2+c3+c4+c5+c6+c7)		// affective empathy measures within control condition
gen d_index=(d1+d2+d3+d4+d5+d6+d7)		// affective empathy measures within disagreement condition
gen p_index=(p1+p2+p3+p4+p5+p6+p7)	// affective empathy measures within empathy condition

// I merge the affective empathy in disag and pt conditions
gen merged = cond(missing(d_index), 0, d_index) + cond(missing(p_index), 0, p_index)
recode merged (0=.)
sum merged

gen stand_empathy=(merged-16.7357)/6.803712 // create a standardized measure for empathy

tab merged
sum merged, meanonly
gen empathyindex_rs = ( merged - r(min) ) / ( r(max)-r(min) )
tab empathyindex_rs

cibar empathyindex_rs,over(disagr_persp) ciopts(lcolor(black)) graphopts(ylab(0(0.05)0.6,nogrid) name(graph_1,replace))

ttest empathyindex_rs, by(disagr_persp)
ttest stand_empathy, by(disagr_persp)


******TABLE 1.**************************************************
reg stand_score i.disagr_persp ib(last).gen b(last).gen#i.disagr_persp i.education age i.cat_ideol ib(7).partisanship i.region
estimates store Model1 // model estimating the effect of empathy (vs placebo)
reg stand_score i.control_disagr ib(last).gen b(last).gen#i.control_disagr i.education age i.cat_ideol ib(7).partisanship i.region
estimates store Model2 // model estimating the effect of exposure to disagreemnet

regress stand_spillover i.disagr_persp ib(last).gen b(last).gen#i.disagr_persp i.education age i.cat_ideol ib(7).partisanship i.region
estimates store Model3
regress stand_spillover i.control_disagr ib(last).gen b(last).gen#i.control_disagr i.education age i.cat_ideol ib(7).partisanship i.region
estimates store Model4

estout Model1 Model2 Model3 Model4, cells(b(star fmt(3)) se(par fmt(2)))  stats(r2)

****** ALTERNATIVE EXPLANATIONS*********************************
tab wordcount
sum wordcount
ttest wordcount,by(disagr_persp)

regress stand_score wordcount
estimates store a
regress stand_score i.treat_ment c.wordcount i.treat_ment#c.wordcount
estimates store b
estout a b, cells(b(star fmt(3)) se(par fmt(2)))  stats(r2)

******FIGURE 3: MEAN ATTITUDE CHANGE in the Direction of Counter-attitudinal Side, Across Experimental Conditions**************************
gen deliberative_change=.
replace deliberative_change=0 if transformation==0 // these people did not change their attitudes
replace deliberative_change=1 if pre_bi_at<4&transformation<0
**hese are people who depolarized their attitudes, (a) so the person is against UBI, and moves towards being in favour
replace deliberative_change=1 if pre_bi_at>3&transformation>0  
//(b) person is in favour and moves towards being against slightly
replace deliberative_change=0 if pre_bi_at<4&transformation>0
replace deliberative_change=0 if pre_bi_at>3&transformation<0
tab deliberative_change

cibar deliberative_change,over(treat_ment) ciopts(lcolor(black)) graphopts(ylab(0(0.05)0.60,nogrid) name(graph_1,replace))
ttest deliberative_change,by(control_disagr)
ttest deliberative_change,by(control_persp)
ttest deliberative_change,by(disagr_persp)


**********************************FIGURE 4*********************
tab stand_score
summarize stand_score, detail

gen dich_cc=.
replace dich_cc=1 if stand_score<=0.0639822 		//equal to and less than the median (50%)
replace dich_cc=2 if stand_score>0.0639822	// more than the median (50%)
tab dich_cc

cibar deliberative_change,over1(dich_cc) over2(treat_ment) ciopts(lcolor(black)) graphopts(ylab(0(0.05)0.60,nogrid) name(graph_1,replace))

reg deliberative_change i.dich_cc if treat_ment==1
reg deliberative_change i.dich_cc if treat_ment==2
reg deliberative_change i.dich_cc if treat_ment==3



reg deliberative_change i.treat_ment i.dich_cc
estimates store a
reg deliberative_change i.treat_ment c.stand_score
estimates store b
coefplot a b, drop(_cons) ci(95) graphregion(color(white)) grid(none) xline(0, lcolor(gs10)) ciopts(recast(rcap))



********************************************************************************
************************* APPENDICES********************************************
********************************************************************************
********************************************************************************
//APPENDIX A. DESCRIPTIVES
tab gen
tab age
tab education
tab partisanship
tab cat_ideol

// APPENDIX C

/// empathic concern
rename c1 sympathetic
rename c2 empathic
rename c3 concerned
rename c4 moved
rename c5 compassionate
rename c6 warm
rename c7 soft_hearted
correlate sympathetic empathic concerned moved compassionate warm soft_hearted


factortest sympathetic empathic concerned moved compassionate warm soft_hearted

factor sympathetic empathic concerned moved compassionate warm soft_hearted,pcf
rotate
//sort the factor loadings from hgh to low.easier to interpret and determine
sortl
alpha sympathetic empathic concerned moved compassionate warm soft_hearted

/// spillover effect
destring policy_at_ad,replace
mean policy_at_ad
sum policy_at_ad

//Appendix E
reg stand_score i.disagr_persp ib(last).gen b(last).gen#i.disagr_persp i.education age i.cat_ideol ib(7).partisanship i.region
estimates store Model1 // model estimating the effect of empathy (vs placebo)
reg stand_score i.control_disagr ib(last).gen b(last).gen#i.control_disagr i.education age i.cat_ideol ib(7).partisanship i.region
estimates store Model2 // model estimating the effect of exposure to disagreemnet

regress stand_spillover i.disagr_persp ib(last).gen b(last).gen#i.disagr_persp i.education age i.cat_ideol ib(7).partisanship i.region
estimates store Model3
regress stand_spillover i.control_disagr ib(last).gen b(last).gen#i.control_disagr i.education age i.cat_ideol ib(7).partisanship i.region
estimates store Model4

estout Model1 Model2 Model3 Model4, cells(b(star fmt(3)) se(par fmt(2)))  stats(r2)


// Appendix F
tab wordcount
mean wordcount
ttest wordcount, by(disagr_persp)

regress stand_score wordcount
estimates store a
regress stand_score i.treat_ment c.wordcount i.treat_ment#c.wordcount
estimates store b
estout a b, cells(b(star fmt(3)) se(par fmt(2)))  stats(r2)


// Appendix I

tab transformation
tab pre_bi_at
// so greater than 3 are in favour and less than 4 against
gen del_cont=.
/// creating a variable so negative values indicate polarized attitude change and positive moving in the counterattitudinal direction

replace del_cont=1 if pre_bi_at<4&transformation==-1       
replace del_cont=2 if pre_bi_at<4&transformation==-2
replace del_cont=3 if pre_bi_at<4&transformation==-3
replace del_cont=4 if pre_bi_at<4&transformation==-4
replace del_cont=5 if pre_bi_at<4&transformation==-5

replace del_cont=1 if pre_bi_at>3&transformation==1 
replace del_cont=2 if pre_bi_at>3&transformation==2
replace del_cont=3 if pre_bi_at>3&transformation==3
replace del_cont=4 if pre_bi_at>3&transformation==4
replace del_cont=5 if pre_bi_at>3&transformation==5

replace del_cont=0 if transformation==0

replace del_cont=-1 if pre_bi_at<4&transformation==1
replace del_cont=-2 if pre_bi_at<4&transformation==2
replace del_cont=-3 if pre_bi_at<4&transformation==3
replace del_cont=-4 if pre_bi_at<4&transformation==4
replace del_cont=-5 if pre_bi_at<4&transformation==5     

replace del_cont=-1 if pre_bi_at>3&transformation==-1 
replace del_cont=-2 if pre_bi_at>3&transformation==-2
replace del_cont=-3 if pre_bi_at>3&transformation==-3
replace del_cont=-4 if pre_bi_at>3&transformation==-4
replace del_cont=-5 if pre_bi_at>3&transformation==-5

tab transformation
tab del_cont
tab deliberative_change
sum del_cont

by treat_ment, sort : tabulate del_cont

cibar del_cont,over(treat_ment) ciopts(lcolor(black)) graphopts(ylab(0(0.05)0.6,nogrid) name(graph_1,replace))

